/*******************************************************************************
 * CMD_DTUtil.sql
 *
 * Generate DTUtil commands to copy SSIS packages between servers. Exeute on
 * Source server.
 */
SET IMPLICIT_TRANSACTIONS OFF
DECLARE @DestS SYSNAME; SET @DestS= ''

SELECT CMD= REPLACE(	'DTUtil -Q -SourceS ' + @@SERVERNAME + ' -DTS "MSDB\'  + foldername+'\'+name + '" -DestS ' + @DestS + ' -COPY DTS;"MSDB\' + foldername+'\'+name + '"'	, '\\','\')
  FROM msdb.dbo.sysssispackages p
	INNER JOIN msdb.dbo.sysssispackagefolders f ON (p.folderid = f.folderid)
  ORDER BY foldername, name
GO